/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * View.java
 *
 * Created on Dec 5, 2011, 10:28:40 AM
 */
package mttestclient;

import javax.swing.JComboBox;
import javax.swing.JSpinner;
import javax.swing.JTextArea;
import javax.swing.JTextField;

/**
 *
     * @author Stewart Gibson 0705777
 */
public class View extends javax.swing.JFrame {

    /** Creates new form View */
    public View(TestModel Model) {
        initComponents();
        TestModel tm = Model;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabelClientNo = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextAreaTestData = new javax.swing.JTextArea();
        jButtonStart = new javax.swing.JButton();
        jSliderNoClientConnections = new javax.swing.JSlider();
        jLabelnoSelected = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextAreaVoteStrings = new javax.swing.JTextArea();
        jLabelVoteStrings = new javax.swing.JLabel();
        jSpinnerTimeout = new javax.swing.JSpinner();
        jLabelTimeout = new javax.swing.JLabel();
        jSpinnerPort = new javax.swing.JSpinner();
        jLabelPort = new javax.swing.JLabel();
        jTextFieldServerIP = new javax.swing.JTextField();
        jLabelServerIP = new javax.swing.JLabel();
        jComboBoxVoteType = new javax.swing.JComboBox();
        jLabelVoteType = new javax.swing.JLabel();
        jLabelServerFeedback = new javax.swing.JLabel();
        jButtonStop = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        jLabelClientNo.setText("Number of connections:");

        jTextAreaTestData.setColumns(20);
        jTextAreaTestData.setEditable(false);
        jTextAreaTestData.setRows(5);
        jScrollPane1.setViewportView(jTextAreaTestData);

        jButtonStart.setText("Start Stress Test");
        jButtonStart.setToolTipText("Begin the Stress Test");

        jSliderNoClientConnections.setMaximum(1000);
        jSliderNoClientConnections.setMinimum(1);
        jSliderNoClientConnections.setPaintLabels(true);

        jLabelnoSelected.setText("0");
        jLabelnoSelected.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);

        jTextAreaVoteStrings.setColumns(20);
        jTextAreaVoteStrings.setRows(5);
        jScrollPane2.setViewportView(jTextAreaVoteStrings);

        jLabelVoteStrings.setText("Vote strings:");

        jSpinnerTimeout.setValue(15);

        jLabelTimeout.setText("Synchronised vote timeout");

        jSpinnerPort.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jSpinnerPort.setValue(23);

        jLabelPort.setText("Port");

        jTextFieldServerIP.setText("127.0.0.1");

        jLabelServerIP.setText("Server IP");

        jComboBoxVoteType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Cascading", "Synchronised", "Continuous" }));
        jComboBoxVoteType.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxVoteTypeActionPerformed(evt);
            }
        });

        jLabelVoteType.setText("Vote type");

        jLabelServerFeedback.setText("Server feedback:");

        jButtonStop.setText("Stop Stress Test");
        jButtonStop.setToolTipText("Begin the Stress Test");
        jButtonStop.setEnabled(false);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 329, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabelTimeout)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jSpinnerTimeout, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(jLabelVoteType)
                                            .addComponent(jLabelPort)
                                            .addComponent(jLabelServerIP))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(jComboBoxVoteType, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jSpinnerPort, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jTextFieldServerIP, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE)))))
                            .addComponent(jLabelServerFeedback))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabelVoteStrings)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jSliderNoClientConnections, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 702, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jButtonStart, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(53, 53, 53)
                        .addComponent(jLabelClientNo)
                        .addGap(18, 18, 18)
                        .addComponent(jLabelnoSelected, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 203, Short.MAX_VALUE)
                        .addComponent(jButtonStop, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonStart, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelClientNo)
                    .addComponent(jLabelnoSelected)
                    .addComponent(jButtonStop, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSliderNoClientConnections, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelServerFeedback)
                    .addComponent(jLabelVoteStrings))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jScrollPane1)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTextFieldServerIP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabelServerIP))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabelPort)
                            .addComponent(jSpinnerPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jComboBoxVoteType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabelVoteType))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jSpinnerTimeout, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabelTimeout)))
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jComboBoxVoteTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxVoteTypeActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBoxVoteTypeActionPerformed

    public JComboBox getjComboBoxVoteType() {
        return jComboBoxVoteType;
    }

    public JSpinner getjSpinnerPort() {
        return jSpinnerPort;
    }

    public JSpinner getjSpinnerTimeout() {
        return jSpinnerTimeout;
    }

    public JTextArea getjTextAreaVoteStrings() {
        return jTextAreaVoteStrings;
    }

    public JTextField getjTextFieldServerIP() {
        return jTextFieldServerIP;
    }

    /**
     * @param args the command line arguments
     */
   
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public javax.swing.JButton jButtonStart;
    public javax.swing.JButton jButtonStop;
    private javax.swing.JComboBox jComboBoxVoteType;
    private javax.swing.JLabel jLabelClientNo;
    private javax.swing.JLabel jLabelPort;
    private javax.swing.JLabel jLabelServerFeedback;
    private javax.swing.JLabel jLabelServerIP;
    private javax.swing.JLabel jLabelTimeout;
    private javax.swing.JLabel jLabelVoteStrings;
    private javax.swing.JLabel jLabelVoteType;
    public javax.swing.JLabel jLabelnoSelected;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    public javax.swing.JSlider jSliderNoClientConnections;
    private javax.swing.JSpinner jSpinnerPort;
    private javax.swing.JSpinner jSpinnerTimeout;
    public javax.swing.JTextArea jTextAreaTestData;
    private javax.swing.JTextArea jTextAreaVoteStrings;
    private javax.swing.JTextField jTextFieldServerIP;
    // End of variables declaration//GEN-END:variables
}
